package com.tianji.remark.controller;


import com.tianji.remark.domain.dto.LikeRecordFormDTO;
import com.tianji.remark.service.ILikedRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 点赞记录表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-11-15
 */
@RestController
@RequestMapping("/likes")
@RequiredArgsConstructor
@Api(tags = "点赞业务相关接口")
public class LikedRecordController {
    private final ILikedRecordService likedRecordService;


    @PostMapping
    @ApiOperation("点赞或取消点赞")
    public void liked(@RequestBody LikeRecordFormDTO likeRecordFormDTO){
        likedRecordService.liked(likeRecordFormDTO);
    }

    @GetMapping
    @ApiOperation("查询当前用户是否点赞了指定的业务")
    public Set<Long> isBizLiked(@RequestParam List<Long> bizIds){
        return likedRecordService.isBizLiked(bizIds);
    }

}
